<extend name="base" />

<block name="style">
<style type="text/css">
.table_addbug{width:700px;}
.table_addbug tr{}
.table_addbug tr td:first-child{border-right:#CCC 1px solid;}
label{color:#333}
</style>
</block>

<block name="md_title">
	<div class="title">Bug添加</div>
    <button class="buttonC" style="float:left">返回列表</button>
    <button class="buttonB">重置</button>
    <button class="buttonA">提交</button>
</block>

<block name="main_cont">
	<table class="table_addbug">
    <form action="addBug" method="post">
    	<tr><td><label>简述</label></td>
        	<td><input type="text" name="title" class="textA"></td></tr>
        <tr><td><label>版本</label></td>
        	<td><input type="text" name="version" class="textB"></td></tr>
        <tr><td><label>负责人</label></td>
        	<td><select name="ownerid" class="selectA">
            		<foreach name="Think.session.bw_AllUser" item="level">
                    	<option value="{$key}">{$level}</option>
                    </foreach>
                </select>
            </td></tr>
         <tr><td><label>平台</label></td>
        	<td><select name="platform" class="selectA">
            		<foreach name="Think.config.BUG_PLATFORM" item="level">
                    	<option value="{$key}">{$level}</option>
                    </foreach>
                </select>
            </td></tr>
        <tr><td><label>模块</label></td>
        	<td><select name="module" class="selectA">
            		<foreach name="Think.config.BUG_STATUS" item="module">
                    	<option value="{$key}">{$module}</option>
                    </foreach>
                </select>
        	</td></tr>
        <tr><td><label>级别</label></td>
        	<td><select name="level" class="selectA">
            		<foreach name="Think.config.BUG_LEVEL" item="level">
                    	<option value="{$key}">{$level}</option>
                    </foreach>
                </select>
            </td></tr>
        <tr><td valign="top"><label>详情</label></td>
        	<td>
            	<textarea id="textArea" name="content"></textarea>
            </td></tr>
    </form>
    </table>
    <div id="uploadContainer" style="display:none;"><input id="file_upload" name="file_upload" type="file" multiple></div>
</block>

<block name="script">
<link href="__ROOT__/Public/WangEditor/css/wangEditor-1.3.12.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" type="text/css" href="__ROOT__/Public/Uploadify/uploadify.css">
<script src="__ROOT__/Public/WangEditor/js/wangEditor-1.3.12.min.js"></script>
<script src="__ROOT__/Public/Uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<script language="javascript">
var editor = $('#textArea').wangEditor({
    uploadImgComponent:$('#uploadContainer'),
	'menuConfig': [
    	['bold', 'underline', 'italic', 'foreColor', 'backgroundColor', 'strikethrough'],
    	['blockquote', 'fontFamily', 'fontSize', 'setHead', 'list', 'justify'],
    	['createLink', 'unLink', 'insertTable'],
    	['insertImage', 'insertVideo', 'insertLocation','insertCode'],
    	['undo', 'redo', 'fullScreen']
    ]
});

$('#file_upload').uploadify({
	'swf'      : '__PUBLIC__/Uploadify/uploadify.swf',
	'uploader' : '{:U("Index/upLoadFile")}',   //上传的方法
	'buttonText' : '浏览图片',
	'onUploadSuccess' : function(file, data, response) {
		var imgSrc	= '__PUBLIC__/Image/Bug/'+data;
		editor.html(editor.html()+"<br><img src="+imgSrc+"><br>");
	}
});

function checkInput(){
	$title	= $("[name='title']").val();
	$version	= $("[name = 'version']").val();
	if($title == ""){
		alert("简述不能为空!"); return false;
	}else{
		return true;
	}
}

</script>
</block>